Skip to content

Typescript

function greeter(person: string) {
    return "Hello, " + person;
}

let user = "Jane User";

document.body.innerHTML = greeter(user);

to compile the code type in a terminal:

tsc greeter.ts
  • Typescript add a static check on top of js
  • compiler can guess with values are valid for some variables defined